home *** CD-ROM | disk | FTP | other *** search
/ Programming Sound Cards / Programming Sound Cards.iso / sound_26 / whooper.asm < prev    next >
Assembly Source File  |  1995-01-01  |  3KB  |  54 lines

  1. code_seg        segment
  2.         assume cs:code_seg
  3.         org     100h
  4.         jmp     start
  5. ;-------------------------------------------
  6. ;B/C Software                        ;Author
  7. ;520 North Stateline Rd
  8. ;Sharon, Pa 16146
  9. ;----------------------------------
  10. message1 db     'press Esc to Quit',0dh,0ah,'$'     ;Esc to end whooper
  11. message2 db     'press any other key to play$'      ;or to go again
  12. ;----------------------------------
  13. start   proc    near
  14.         mov     ah,9                 ;DOS function number to print string
  15.         mov     dx,offset message1   ;the message
  16.         int     21h                  ;DOS interrupt
  17.         mov     ah,9                 ;DOS function number to print string
  18.         mov     dx,offset message2   ;the message
  19.         int     21h                  ;DOS interrupt
  20. begin:  mov     ah,0                 ;BIOS function wait for key press
  21.         int     16h                  ;BIOS interrupt
  22.         cmp     ah,1                 ;Esc scan code 
  23.         jz      done                 ;do we stop ?
  24.         call    whooper              ;no call whooping sound
  25.         jmp     begin                ;go see if we do it again
  26. done:   mov     ax,4c00h             ;no exit back to DOS
  27.         int     21h                  ;DOS interrupt
  28. start   endp
  29. ;-------------------------------------------
  30. whooper proc    near
  31.         cli                          ;no interrupts
  32. backery:mov     bx,5000              ;start frequency low
  33.         mov     al,10110110xb        ;channel 2
  34.         out     43h,al               ;send it
  35. backerx:mov     ax,bx                ;place frequency in (ax)
  36.         out     42h,al               ;send LSB first
  37.         mov     al,ah                ;place MSB in al
  38.         out     42h,al               ;send it next
  39.         in      al,61h               ;lets turn the speaker on
  40.         or      al,00000011xb        ;this number will do it
  41.         out     61h,al               ;send it 
  42.         mov     cx,50                ;50 is best for (8mhz clock)
  43. looperx:loop    looperx              ;delay so we can hear sound
  44.         dec     bx                   ;decremnent repeat count
  45.         jnz     backerx              ;if not = 0 go do again
  46.         in      al,61h               ;if were done - turn speaker off
  47.         and     al,11111100xb        ;this number will do it
  48.         out     61h,al               ;send it
  49.         sti                          ;enable interrupts
  50.         ret                          ;go see if user wants to go again
  51. whooper endp
  52. ;----------------------------------
  53. code_seg        segment
  54.